<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      window.$ = window.jQuery = require("jquery");
    </script>
  </head>

  <body>
    <div id="printElement"></div>
    <script>
      const { ipcRenderer, BrowserWindow } = require("electron");

      $(document).ready(function() {
        ipcRenderer.on("print-new", (event, data) => {
          document.title = data.title ? data.title : "hiprint打印";
          document.getElementById("printElement").innerHTML = data.html;
          ipcRenderer.send("do", {
            printer: data.printer,
            templateId: data.templateId,
            socketId: data.socketId,
            pageNum: $(".hiprint-printPaper").length,
          });
        });
      });
    </script>
  </body>
</html>
